package com.konglingyuan.spring01.run;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.konglingyuan.spring01.dao.impl.Dog;

public class Run {

	public static void main(String[] args) {
		ApplicationContext ac = new ClassPathXmlApplicationContext("./application.xml");
		
		Dog dog = ac.getBean("dog", Dog.class);
		Dog dog_name = ac.getBean("d1", Dog.class);
		Dog dog_other_name = ac.getBean("other_name", Dog.class);
		
		Dog dog_class_identification = ac.getBean("com.konglingyuan.spring01.dao.impl.Dog#0", Dog.class);
		Dog dog_class_identification1 = ac.getBean("com.konglingyuan.spring01.dao.impl.Dog#0", Dog.class);
		
		System.out.println(dog);
		System.out.println(dog_name);
		System.out.println(dog_other_name);
		
		//scope = "prototype"
		System.out.println(dog_class_identification);
		System.out.println(dog_class_identification1);
		
		DBHelper h = ac.getBean("dbHelper", DBHelper.class);
		System.out.println(h);
		
	}

}
